#ifndef S3C2440_H
#define S3C2440_H

//CLOCK AND POWER REGISTER
#define LOCKTIME (*(volatile unsigned int *)0x4c000000)
#define MPLLCON  (*(volatile unsigned int *)0x4c000004)
#define UPLLCON  (*(volatile unsigned int *)0x4c000008)
#define CLKCON   (*(volatile unsigned int *)0x4c00000C)
#define CLKSLOW  (*(volatile unsigned int *)0x4c000010)
#define CLKDIVN  (*(volatile unsigned int *)0x4c000014)
#define CAMDIVN  (*(volatile unsigned int *)0x4c000018)


//UART SPECIAL REGISTER
//UART0
#define ULCON0   (*(volatile unsigned int *)0x50000000)
#define UCON0    (*(volatile unsigned int *)0x50000004)
#define UFCON0   (*(volatile unsigned int *)0x50000008)
#define UMCON0   (*(volatile unsigned int *)0x5000000c)
#define UTRSTAT0 (*(volatile unsigned int *)0x50000010)
#define UERSTAT0 (*(volatile unsigned int *)0x50000014)
#define UFSTAT0  (*(volatile unsigned int *)0x50000018)
#define UMSTAT0  (*(volatile unsigned int *)0x5000001c)
#ifdef _BIG_ENDIAN   //little endian
#define UTXH0    (*(volatile unsigned char *)0x50000023)
#define URXH0    (*(volatile unsigned char *)0x50000027)
#else  //little endian
#define UTXH0    (*(volatile unsigned char *)0x50000020)
#define URXH0    (*(volatile unsigned char *)0x50000024)
#endif
#define UBRDIV0  (*(volatile unsigned int *)0x50000028)
//UART1
#define ULCON1   (*(volatile unsigned int *)0x50004000)
#define UCON1    (*(volatile unsigned int *)0x50004004)
#define UFCON1   (*(volatile unsigned int *)0x50004008)
#define UMCON1   (*(volatile unsigned int *)0x5000400c)
#define UTRSTAT1 (*(volatile unsigned int *)0x50004010)
#define UERSTAT1 (*(volatile unsigned int *)0x50004014)
#define UFSTAT1  (*(volatile unsigned int *)0x50004018)
#define UMSTAT1  (*(volatile unsigned int *)0x5000401c)
#ifdef _BIG_ENDIAN
#define UTXH1    (*(volatile unsigned char *)0x50004023)
#define URXH1    (*(volatile unsigned char *)0x50004027)
#else   //little endian
#define UTXH1    (*(volatile unsigned char *)0x50004020)
#define URXH1    (*(volatile unsigned char *)0x50004024)
#endif
#define UBRDIV1  (*(volatile unsigned int *)0x50004028)
//UART2
#define ULCON2   (*(volatile unsigned int *)0x50008000)
#define UCON2    (*(volatile unsigned int *)0x50008004)
#define UFCON2   (*(volatile unsigned int *)0x50008008)
#define UTRSTAT2 (*(volatile unsigned int *)0x50008010)
#define UERSTAT2 (*(volatile unsigned int *)0x50008014)
#define UFSTAT2  (*(volatile unsigned int *)0x50008018)
#ifdef _BIG_ENDIAN
#define UTXH2    (*(volatile unsigned char *)0x50008023)
#define URXH2    (*(volatile unsigned char *)0x50008027)
#else   //little endian
#define UTXH2    (*(volatile unsigned char *)0x50008020)
#define URXH2    (*(volatile unsigned char *)0x50008024)
#endif
#define UBRDIV2  (*(volatile unsigned int *)0x50008028)


//PORTB CONTROL REGISTER(GPBCON,GPBDAT,GPBUP)
#define GPBCON (*(volatile unsigned int *)(0x56000010))
#define GPBDAT (*(volatile unsigned int *)(0x56000014))
#define GPBUP  (*(volatile unsigned int *)(0x56000018))
#define GPCON_IN  0X00  //configure port input
#define GPCON_OUT 0X01  //configure port output

//PORTH CONTROL REGISTER(GPHCON,GPHDAT,GPHUP)
#define GPHCON (*(volatile unsigned int *)(0x56000070))
#define GPHDAT (*(volatile unsigned int *)(0x56000074))
#define GPHUP  (*(volatile unsigned int *)(0x56000078))

//PORTE
#define GPECON (*(volatile unsigned int *)(0x56000040))
#define GPEDAT (*(volatile unsigned int *)(0x56000044))
#define GPEUP  (*(volatile unsigned int *)(0x56000048))
//DMA SPECIAL REGISTERS
//chanel0
#define DISRC0      (*(volatile unsigned int *)(0x4b000000))
#define DISRCC0     (*(volatile unsigned int *)(0x4b000004))
#define DIDST0      (*(volatile unsigned int *)(0x4b000008))
#define DIDSTC0     (*(volatile unsigned int *)(0x4b00000c))
#define DCON0       (*(volatile unsigned int *)(0x4b000010))
#define DSTAT0      (*(volatile unsigned int *)(0x4b000014))
#define DCSRC0      (*(volatile unsigned int *)(0x4b000018))
#define DCDST0      (*(volatile unsigned int *)(0x4b00001c))
#define DMASKTRIG0  (*(volatile unsigned int *)(0x4b000020))
//chanel1
#define DISRC1      (*(volatile unsigned int *)(0x4b000040))
#define DISRCC1     (*(volatile unsigned int *)(0x4b000044))
#define DIDST1      (*(volatile unsigned int *)(0x4b000048))
#define DIDSTC1     (*(volatile unsigned int *)(0x4b00004c))
#define DCON1       (*(volatile unsigned int *)(0x4b000050))
#define DSTAT1      (*(volatile unsigned int *)(0x4b000054))
#define DCSRC1      (*(volatile unsigned int *)(0x4b000058))
#define DCDST1      (*(volatile unsigned int *)(0x4b00005c))
#define DMASKTRIG1  (*(volatile unsigned int *)(0x4b000060))

//chanel2
#define DISRC2      (*(volatile unsigned int *)(0x4b000080))
#define DISRCC2     (*(volatile unsigned int *)(0x4b000084))
#define DIDST2      (*(volatile unsigned int *)(0x4b000088))
#define DIDSTC2     (*(volatile unsigned int *)(0x4b00008c))
#define DCON2       (*(volatile unsigned int *)(0x4b000090))
#define DSTAT2      (*(volatile unsigned int *)(0x4b000094))
#define DCSRC2      (*(volatile unsigned int *)(0x4b000098))
#define DCDST2      (*(volatile unsigned int *)(0x4b00009c))
#define DMASKTRIG2  (*(volatile unsigned int *)(0x4b0000a0))

//chanel3
#define DISRC3      (*(volatile unsigned int *)(0x4b0000c0))
#define DISRCC3     (*(volatile unsigned int *)(0x4b0000c4))
#define DIDST3      (*(volatile unsigned int *)(0x4b0000c8)
#define DIDSTC3     (*(volatile unsigned int *)(0x4b0000cc))
#define DCON3       (*(volatile unsigned int *)(0x4b0000d0))
#define DSTAT3      (*(volatile unsigned int *)(0x4b0000d4))
#define DCSRC3      (*(volatile unsigned int *)(0x4b0000d8))
#define DCDST3      (*(volatile unsigned int *)(0x4b0000dc))
#define DMASKTRIG3  (*(volatile unsigned int *)(0x4b0000e0))

//interrupt controller special register
#define SRCPND      (*(volatile unsigned int *)(0x4a000000))
#define INTMOD      (*(volatile unsigned int *)(0x4a000004))
#define INTMSK      (*(volatile unsigned int *)(0x4a000008))
#define PRIORITY    (*(volatile unsigned int *)(0x4a00000c))
#define INTPND      (*(volatile unsigned int *)(0x4a000010))
#define INTOFFSET   (*(volatile unsigned int *)(0x4a000014))
#define SUBSRCPND   (*(volatile unsigned int *)(0x4a000018))
#define INTSUBMSK   (*(volatile unsigned int *)(0x4a00001c))

//flash conrtonler

#define NFCONF      (*(volatile unsigned int *)(0x4e000000))
#define NFCONT      (*(volatile unsigned int *)(0x4e000004))
#define NFCMMD      (*(volatile unsigned int *)(0x4e000008))
#define NFADDR      (*(volatile unsigned int *)(0x4e00000c))
#define NFDATA      (*(volatile unsigned int *)(0x4e000010))
#define NFDATA8     (*(volatile unsigned char *)(0x4e000010))
#define NFMECCD0    (*(volatile unsigned int *)(0x4e000014))
#define NFMECCD1    (*(volatile unsigned int *)(0x4e000018))
#define NFSECCD     (*(volatile unsigned int *)(0x4e00001c))
#define NFSTAT      (*(volatile unsigned int *)(0x4e000020))
#define NFESTAT0    (*(volatile unsigned int *)(0x4e000024))
#define NFESTAT1    (*(volatile unsigned int *)(0x4e000028))
#define NFMECC0     (*(volatile unsigned int *)(0x4e00002c))
#define NFMECC1     (*(volatile unsigned int *)(0x4e000030))
#define NFSECC      (*(volatile unsigned int *)(0x4e000034))
#define NFSBLK      (*(volatile unsigned int *)(0x4e000038))
#define NFEBLK      (*(volatile unsigned int *)(0x4e00003C))

#define BWSCON      (*(volatile unsigned int *)(0x48000000))
#define BANKCON0    (*(volatile unsigned int *)(0x48000004))
#define BANKCON1    (*(volatile unsigned int *)(0x48000008))
#define BANKCON2    (*(volatile unsigned int *)(0x4800000c))
#define BANKCON3    (*(volatile unsigned int *)(0x48000010))
#define BANKCON4    (*(volatile unsigned int *)(0x48000014))
#define BANKCON5    (*(volatile unsigned int *)(0x48000018))

#define BANKCON6    (*(volatile unsigned int *)(0x4800001c))
#define BANKCON7    (*(volatile unsigned int *)(0x48000020))
#define REFRESH     (*(volatile unsigned int *)(0x48000024))
#define BANKSIZE    (*(volatile unsigned int *)(0x48000028))
#define MRSRB6      (*(volatile unsigned int *)(0x4800002c))
#define MRSRB7      (*(volatile unsigned int *)(0x48000030))

//I2C Special Register
#define IICCON      (*(volatile unsigned int *)(0x54000000))
#define IICSTAT     (*(volatile unsigned int *)(0x54000004))
#define IICADD      (*(volatile unsigned int *)(0x54000008))
#define IICDS       (*(volatile unsigned int *)(0x5400000c))
#define IICLC       (*(volatile unsigned int *)(0x54000010))

//MMC SD SDIO CONTROLER
#define SDICON      (*(volatile unsigned int *)(0x5a000000))
#define SDIPRE      (*(volatile unsigned int *)(0x5a000004))
#define SDICMDARG   (*(volatile unsigned int *)(0x5a000008))
#define SDICMDCON   (*(volatile unsigned int *)(0x5a00000c))
#define SDICMDSTA   (*(volatile unsigned int *)(0x5a000010))
#define SDIRSP0     (*(volatile unsigned int *)(0x5a000014))
#define SDIRSP1     (*(volatile unsigned int *)(0x5a000018))

//pwm timer
#define TCFG0       (*(volatile unsigned int *)(0x51000000))
#define TCFG1       (*(volatile unsigned int *)(0x51000004))
#define TCON        (*(volatile unsigned int *)(0x51000008))
#define TCNTB0      (*(volatile unsigned int *)(0x5100000c))
#define TCMPB0      (*(volatile unsigned int *)(0x51000010))
#define TCNTO0      (*(volatile unsigned int *)(0x51000014))

#define TCNTB1      (*(volatile unsigned int *)(0x51000018))
#define TCMPB1      (*(volatile unsigned int *)(0x5100001c))
#define TCNTO1      (*(volatile unsigned int *)(0x51000020))

#define TCNTB2      (*(volatile unsigned int *)(0x51000024))
#define TCMPB2      (*(volatile unsigned int *)(0x51000028))
#define TCNTO2      (*(volatile unsigned int *)(0x5100002c))

#define TCNTB3      (*(volatile unsigned int *)(0x51000030))
#define TCMPB3      (*(volatile unsigned int *)(0x51000034))
#define TCNTO3      (*(volatile unsigned int *)(0x51000038))

#define TCNTB4      (*(volatile unsigned int *)(0x5100003c))
#define TCNTO4      (*(volatile unsigned int *)(0x51000040))




#endif
